<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- 引入easyui的样式 -->
<link rel="stylesheet"  type="text/css" href="${pageContext.request.contextPath}/themes/default/easyui.css">
<link rel="stylesheet"  type="text/css" href="${pageContext.request.contextPath}/themes/icon.css">
<!-- js文件 -->
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js"></script>
</head>
<script type="text/javascript">

//布置作业
function homejob() {
	//获取被选中需要修改的信息	
	 $('#dlg').dialog('open').dialog('setTitle','布置作业').dialog('center');
	 $('#fm').form('clear');
	 $('#jd').hide(); 
} 
	//将增加的信息请求发送至后台处理 	
	 $(function(){
		 $("#ok").click(function(){
			 var cid =$("#Classe").combobox('getValue');
			 var jname = $("#jname").val();
			 var uid =${user.uid};
				$.ajax({	   				
	   				type:"post",
	   				url:"addHomeJob",
	   				data:{"jname":jname,"uid":uid,"cid":cid},
	   				dataType:"text",
	   				success:function(data){
	   					if(data=="true"){
			    			$.messager.alert('提示','新增成功','info',function(){
			    				$('#dg').datagrid('reload'); 
			    				$('#dlg').dialog('close')	
				    			}); 			    							 	    					    			
			    		  }else{
			    			  $.messager.alert('提示','新增失败','info',function(){
				    				$('#dg').datagrid('reload'); 
			    			  });
			    		  }
			    	}    		   		

	    		})
		 })
	 })




</script>
<body>
	<table id="dg" title="作业布置信息" class="easyui-datagrid" method="post"
            toolbar="#toolbar" pagination="true" fit="true"  
            striped="true"   url="homejob"
            rownumbers="true" fitColumns="true" border="false">         
        <thead>
            <tr>                
                <th field="jid" hidden="true" >作业编号</th>
                <th field="jname" width="50" resizable="false">作业名字</th>                   
            </tr>
        </thead>
    </table>
    <div id="toolbar">       
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="homejob()">布置作业</a>
    </div>
      <!-- 个人信息框 -->  
        <div id="dlg" class="easyui-dialog" style="width:400px;height:280px;padding:10px 20px"
            closed="true" buttons="#dlg-buttons">
        <div class="ftitle" style="margin-left:150px">作业信息</div><br>  
        <form id="fm" method="post" novalidate> 
        	<div class="fitem"style="margin-left:100px" >
                <label>班级名字:</label>
                <input id="Classe" class="easyui-combobox" name="Classe" style="width:90px;"
    			data-options="editable:false,valueField:'cid',textField:'cname'
    			,url:'findClasse'" required="required" missingMessage="请选择班级"/>  
            </div> 
            <br/>    
            <div class="fitem" id="na" style="margin-left:30px">
            <label>作业名字:</label>
            <input id="jname" class="easyui-textbox" style="width:300px;height:100px;">
            </div>
        </form>
    </div>
    <div id="dlg-buttons">
        <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok"  style="width:90px;" id="ok">布置作业</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" 
        onclick="javascript:$('#dlg').dialog('close')" style="width:90px;">取消</a>
    </div>
</body>
</html>